package com.wuax.mapper;

import com.wuax.domain.Book;
import com.wuax.domain.vo.BookVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

@Mapper
public interface BookMapper {

    List<BookVo> select(Book book);

    int selectCount(Book book);

    List<BookVo> selectByTypeId(String bookTypeId);
    
    /**
     * 根据分类ID和年月查询该分类下的图书数量（用于生成编码序号）
     */
    int selectCountByTypeIdAndYearMonth(@Param("bookTypeId") String bookTypeId, @Param("yearMonth") String yearMonth);
    
    /**
     * 根据分类ID获取分类编码（用于生成编码前缀）
     */
    String selectBookTypeCodeById(@Param("bookTypeId") String bookTypeId);

    int insert(Book book);

    int update(Book book);

    int batchDelete(@Param("bookIds") List<String> bookIds);

    int borrowBook(String borrowId);
}
